<?php
namespace app\model\auth;

use think\Model;
use think\model\concern\SoftDelete;

/*
 * 角色模型.
 *
 * @property integer $id
 */
class Role extends Model
{
    protected $table = 'auth_role';      // 表名
    /*
     * @inheritdoc
     */
    protected $field = [
		'name',
		'role_id',
        'perms',
		'memo'
    ];
    protected $type = [
        'perms' => 'array',
    ];
    /**
     * 名称搜索
     *
     * @param [type] $query
     * @param [type] $value
     * @param [type] $data
     * @return void
     */
    public function searchNameAttr($query, $value, $data)
    {
        !empty($value) && $query->where('name', $value);
    }
    public function searchStatusAttr($query, $value, $data)
    {
        $value > 0 && $query->where('status', $value);
    }
}
